package com.mazaiting.redeye.domain;

import com.mazaiting.redeye.interfaces.IJsonBean;
import com.mazaiting.redeye.utils.JackJsonUtil;

/***
 *
 *
 *                                                    __----~~~~~~~~~~~------___
 *                                   .  .   ~~//====......          __--~ ~~
 *                   -.            \_|//     |||\\  ~~~~~~::::... /~
 *                ___-==_       _-~o~  \/    |||  \\            _/~~-
 *        __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *    _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *  .~       .~       |   \\ -_    /  /-   /   ||      \   /
 * /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 * |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *          '         ~-|      /|    |-~\~~       __--~~
 *                      |-~~-_/ |    |   ~\_   _-~            /\
 *                           /  \     \__   \/~                \__
 *                       _--~ _/ | .-~~____--~-/                  ~~==.
 *                      ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                 -_     ~\      ~~---l__i__i__i--~~_/
 *                                 _-~-__   ~)  \--______________--~~
 *                               //.-~~~-~_--~- |-------~~~~~~~~
 *                                      //.-~~~--\
 *                               神兽保佑
 *                              代码无BUG!
 * @author mazaiting
 * @date 2019-07-02
 * @decription 图片相关信息
 */
public class ImageBean implements IJsonBean {
    /**
     * 是否上传成功
     */
    private boolean isSucceed;
    /**
     * 图片名称
     */
    private String name;
    /**
     * 图片地址
     */
    private String url;
    /**
     * 异常信息
     */
    private String msg;

    public ImageBean() {}

    public ImageBean(boolean isSucceed, String name, String url) {
        this.isSucceed = isSucceed;
        this.name = name;
        this.url = url;
    }

    public ImageBean(boolean isSucceed, String name, String url, String msg) {
        this.isSucceed = isSucceed;
        this.name = name;
        this.url = url;
        this.msg = msg;
    }

    /**
     * 设置图像信息
     * @param isSucceed 是否成功
     * @param name 文件名
     * @param msg 信息
     */
    public void setImageBean(boolean isSucceed, String name, String msg) {
        this.isSucceed = isSucceed;
        this.name = name;
        this.msg = msg;
    }

    public boolean isSucceed() {
        return isSucceed;
    }

    public void setSucceed(boolean succeed) {
        isSucceed = succeed;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toJson() {
        return JackJsonUtil.toJson(this);
    }

    @Override
    public ImageBean fromJson(String content) {
        return JackJsonUtil.formJson(content, ImageBean.class);
    }
}
